package org.apache.catalina.util;

import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;

public final class Enumerator implements Enumeration {

    public Enumerator(Collection collection) {
        this(collection.iterator());
    }

    public Enumerator(Iterator iterator) {
        super();
        this.iterator = iterator;
    }

    public Enumerator(Map map) {
        this(map.values().iterator());
    }

    private Iterator iterator = null;
    public boolean hasMoreElements() {
        return (iterator.hasNext());
    }

    public Object nextElement() throws NoSuchElementException {
        return (iterator.next());
    }
}
